package com.ejlchina.tool.util

import android.bluetooth.BluetoothGatt
import android.bluetooth.BluetoothGattCharacteristic
import android.bluetooth.BluetoothGattService
import com.ejlchina.tool.constant.BLE_CHARACTER_WRITE
import com.ejlchina.tool.constant.BLE_SERVICE

private fun getServer(gatt: BluetoothGatt): BluetoothGattService? {
    for (item in gatt.services){
        if (item.uuid.toString().contains(BLE_SERVICE,true)){
            return item
        }
    }
    return null
}

private fun getCharacterWrite(gatt: BluetoothGatt): BluetoothGattCharacteristic? {
    for (item in gatt.services){
        if (item.uuid.toString().contains(BLE_SERVICE,true)){
            for (item2 in item.characteristics){
                if (item2.uuid.toString().contains(BLE_CHARACTER_WRITE)){
                    return item2
                }
            }
        }
    }
    return null
}

